fix(rpc) Synchronize RPC requests only within the TP group. - #25213
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
/tag-run-ci-label |
| logger.error(f"Failed to call rpc {recv_req.method}: {str(e)}") | ||
|
|
||
| barrier() | ||
| barrier(group=self.tp_group.device_group) |
There was a problem hiding this comment.
Why use device group? does tp_cpu_group work?
There was a problem hiding this comment.
Thanks for the reminder — yes, tp_cpu_group does work, and it's actually the more recommended approach.
|
@merrymercy @Ying1123 @hnyls2002 @xiezhq-hermann Hi, could you please help review this PR? |
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
1 similar comment
|
/rerun-failed-ci |
|
@merrymercy @Ying1123 @hnyls2002 @xiezhq-hermann @cctry Hi, could you please help review this PR? |
|
Hi, sorry to bother you. This PR has been approved. When you have a moment, could you please help merge it? Thanks! @ShangmingCai @xiezhq-hermann |
|
@copilot resolve the merge conflicts in this pull request |
…ect#25213) Co-authored-by: Zhiqiang Xie <xiezhq@stanford.edu>
…ect#25213) Co-authored-by: Zhiqiang Xie <xiezhq@stanford.edu>
…ect#25213) Co-authored-by: Zhiqiang Xie <xiezhq@stanford.edu>
…ect#25213) Co-authored-by: Zhiqiang Xie <xiezhq@stanford.edu>
Motivation
As discussed in issue #24687, there is a conflict between handle_rpc_request() and Pipeline Parallelism (PP) that causes a deadlock.
Root Cause:
When PP rank 0 receives an RPC request, the following sequence leads to a deadlock:
PP rank 0: recv_requests() → receives RPC request
PP rank 0: process_input_requests() → calls barrier() inside handle_rpc_request()
Other PP ranks: blocked in recv_requests() waiting for requests from rank 0 via point_to_point_pyobj
PP rank 0: hasn't sent requests yet (send happens after process) → DEADLOCK
Modifications
Solution:
Change barrier() in handle_rpc_request() to only synchronize within the TP group instead of globally:
Before
barrier() # Waits for all TP×PP processes
After
barrier(group=self.tp_group.device_group) # Only waits within TP group
This avoids the deadlock because:
The barrier no longer requires cross-stage synchronization (PP ranks don't need to wait for each other)
Each PP stage independently synchronizes its own TP ranks during RPC handling
Other PP ranks can continue executing recv_requests() without being blocked by rank 0's RPC barrier
Accuracy Tests
Speed Tests and Profiling
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ⏳ Run #29631202458
Latest PR Test (Extra): ❌ Run #29631202342